// Kony

#pragma once

#include "CoreMinimal.h"
#include "MVVMViewModelBase.h"
#include "Game/LoadScreenSaveGame.h"
#include "MVVM_LoadSlot.generated.h"

//多播动态广播 发送组件切换器的索引
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSetWidgetSwitcherIndex, int32, WidgetSwitcherIndex);
//选择槽位广播，用于设置哪个槽位被选中，清空其他槽位的选择
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FEnableSelectSlotButton, bool, bEnable);
/**
 * MVVM 视图模型 加载槽模型类, 这个模型就是 存档本身
 */
UCLASS()
class GASC_HUANLING_API UMVVM_LoadSlot : public UMVVMViewModelBase
{
	GENERATED_BODY()
public:
	//初始化插槽 模型
	void InitializeSlot();
	//多播动态广播 获取组件切换器的索引
	UPROPERTY(BlueprintAssignable)
	FSetWidgetSwitcherIndex SetWidgetSwitcherIndex;
	//多播动态广播 选择槽位广播，用于设置哪个槽位被选中，清空其他槽位的选择
	UPROPERTY(BlueprintAssignable)
	FEnableSelectSlotButton EnableSelectSlotButton;
	//槽位索引
	UPROPERTY()
	int32 SlotIndex;

	//加载槽状态，这个用于记录当前要切换到哪个插槽 用来找到对应索引切换
	UPROPERTY()
	TEnumAsByte<ESaveSlotStatus> SlotStatus;
	//玩家开始位置标签，用于存储玩家最后一次存档所在位置
	UPROPERTY()
	FName PlayerStartTag;

	UPROPERTY()
	FString MapAssetName;

	/** Field Notifies */
	//设置玩家昵称
	void SetPlayerName(FString InPlayerName);
	//设置地图名称
	void SetMapName(FString InMapName);
	//设置玩家等级
	void SetPlayerLevel(int32 InLevel);
	//设置加载槽名称
	void SetLoadSlotName(FString InLoadSlotName);

	FString GetPlayerName() const { return PlayerName; }
	FString GetMapName() const { return MapName; }
	int32 GetPlayerLevel() const { return PlayerLevel; }
	FString GetLoadSlotName() const { return LoadSlotName; }

private:
	/** Field Notifies */
	//玩家昵称
	UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Setter, Getter, meta = (AllowPrivateAccess="true"));
	FString PlayerName;
	//玩家等级
	UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Setter, Getter, meta = (AllowPrivateAccess="true"));
	int32 PlayerLevel;
	//地图名
	UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Setter, Getter, meta = (AllowPrivateAccess="true"));
	FString MapName;
	//加载槽名称
	UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Setter, Getter, meta = (AllowPrivateAccess="true"));
	FString LoadSlotName;
};
